﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VISS.API.Admins;

public partial class Controls_menu : System.Web.UI.UserControl {

    protected string _strMenu = "";
    protected string _strSubMenu = "";
    protected bool _bHasSubMenu = false;
    
    protected void Page_Load(object sender, EventArgs e) {
        _strMenu += "<a class='" + GetMenuClass(EMenuIndex.Home) + "' href='" + AppSettings.RootURL + "trang_chu'>Trang chủ</a>";
        
        if (AppSettings.CheckRight(Session, EAdminRight.User)) {
            _strMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetMenuClass(EMenuIndex.User) + "' href='" + AppSettings.UserURL + "thong_tin_chung'>Users</a>";
        }

        if (AppSettings.CheckRight(Session, EAdminRight.Commons))
        {
            _strMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetMenuClass(EMenuIndex.Commons) + "' href='" + AppSettings.CommonURL + "thong_tin_chung'>Danh mục</a>";
        }

        switch(AppSettings.MenuIndex) {
            case EMenuIndex.User:
                _bHasSubMenu = true;
                GetUsersMenu();
                break;
            case EMenuIndex.Commons:
                _bHasSubMenu = true;
                GetCommonsMenu();
                break;
        }
    }

    protected string GetMenuClass(EMenuIndex menuIndex) {
        string str = "menu";
        if (AppSettings.MenuIndex == menuIndex) {
            str = "menu_active";
        }
        return str;
    }

    protected string GetSubMenuClass(ESubMenuIndex subMenuIndex) {
        string str = "menu";
        if (AppSettings.SubMenuIndex == subMenuIndex) {
            str = "menu_active";
        }
        return str;
    }

    protected void GetCommonsMenu() {
        _strSubMenu = "<a class='" + GetSubMenuClass(ESubMenuIndex.Attraction) + "' href='" + AppSettings.CommonURL + "do_thu_hut'>Độ thu hút</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Body) + "' href='" + AppSettings.CommonURL + "the_hinh'>Thể hình</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.City) + "' href='" + AppSettings.CommonURL + "thanh_pho'>Thành phố</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Country) + "' href='" + AppSettings.CommonURL + "quoc_gia'>Quốc gia</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Driking) + "' href='" + AppSettings.CommonURL + "uong_ruou'>Uống rượu</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Education) + "' href='" + AppSettings.CommonURL + "hoc_van'>Học vấn</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Ethnic) + "' href='" + AppSettings.CommonURL + "dan_toc'>Dân tộc</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.HairStyle) + "' href='" + AppSettings.CommonURL + "kieu_toc'>Kiểu tóc</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.House) + "' href='" + AppSettings.CommonURL + "nha_cua'>Nhà cửa</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Job) + "' href='" + AppSettings.CommonURL + "nghe_nghiep'>Nghề nghiệp</a>";
        _strSubMenu += "<br />";
        _strSubMenu += "<a class='" + GetSubMenuClass(ESubMenuIndex.Language) + "' href='" + AppSettings.CommonURL + "ngon_ngu'>Ngôn ngữ</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.LivingStatus) + "' href='" + AppSettings.CommonURL + "cu_tru'>Cư trú</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.LunarYear) + "' href='" + AppSettings.CommonURL + "nam_am_lich'>Năm âm lịch</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.MaritalStatus) + "' href='" + AppSettings.CommonURL + "hon_nhan'>Hôn nhân</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Moving) + "' href='" + AppSettings.CommonURL + "di_chuyen'>Di chuyển</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Nationality) + "' href='" + AppSettings.CommonURL + "quoc_tich'>Quốc tịch</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Pet) + "' href='" + AppSettings.CommonURL + "vat_nuoi'>Vật nuôi</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Religion) + "' href='" + AppSettings.CommonURL + "ton_giao'>Tôn giáo</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Smoking) + "' href='" + AppSettings.CommonURL + "hut_thuoc'>Hút thuốc</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.ZodiacMonth) + "' href='" + AppSettings.CommonURL + "thang_hoang_dao'>Cung</a>";
    }

    protected void GetUsersMenu() {
        _strSubMenu = "<a class='" + GetSubMenuClass(ESubMenuIndex.General) + "' href='" + AppSettings.UserURL + "thong_tin_chung'>Thông tin chung</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.UserList) + "' href='" + AppSettings.UserURL + "danh_sach'>Danh sách user</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Search) + "' href='" + AppSettings.UserURL + "tim_kiem'>Tìm kiếm</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Mesasge) + "' href='" + AppSettings.UserURL + "tin_nhan'>Tin nhắn</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Report) + "' href='" + AppSettings.UserURL + "vi_pham'>Báo cáo vi phạm</a>";
        _strSubMenu += "&nbsp;&nbsp;|&nbsp;&nbsp;<a class='" + GetSubMenuClass(ESubMenuIndex.Mail) + "' href='" + AppSettings.UserURL + "mail'>Gửi mail</a>";
    }
}
